#include "ProcessPool.hpp"



void Usage()
{
    std::cout << "Usage: processpool nr_child" << std::endl;
    exit(USAGE_ERROR);
}

int main(int argc, char *argv[])
{
    if (2 != argc)
        Usage();

    int nr_child = std::stoi(argv[1]);
    ProcessPool *pp = new ProcessPool(nr_child, Worker);
    /* 1. Initialize processPool */
    pp->InitProcessPool();
    // /* 2. dispatch task */
    pp->DispatchTask();
    // /* 3. exit process pool */
    pp->CleanProcessPool();



    /* 1. Initialize processPool */

    // std::vector<Channel> channels;
    // int nr_child = std::stoi(argv[1]);
    // // InitProcessPool(nr_child, channels, &Worker);
    // InitProcessPool(nr_child, channels, Worker);
    // // DebugPrint(channels);

    // /* 2. dispatch task */

    // DispatchTask(channels);

    // /* 3. exit process pool */

    // CleanProcessPool(channels);

    //sleep(100);
    return 0;
}